package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Vector;

import model.Payment;
import util.ConnectDataBase;

public class PaymentDAO {
	Vector listempayment;
	ConnectDataBase connectDataBase;

	public PaymentDAO() {
		listempayment = new Vector();
		connectDataBase = new ConnectDataBase();
	}

	public Vector getListempayment() {
		try {
			ResultSet rs = connectDataBase
					.query_select("Select * from Payment");

			while (rs.next()) {

				int payment_id = Integer.parseInt(rs.getString("payment_id"));
				int customer_id = Integer.parseInt(rs.getString("customer_id"));
				int employee_id = Integer.parseInt(rs.getString("employee_id"));
				long payment_Amount = Long.parseLong(rs
						.getString("payment_Amount"));
				int reservation_id = Integer.parseInt(rs
						.getString("reservation_id"));

				Payment p = new Payment(payment_id, customer_id, employee_id,
						payment_Amount, reservation_id);

				listempayment.add(p);

			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return listempayment;
	}

	public void setListempayment(Vector listempayment) {
		this.listempayment = listempayment;
	}

}
